var t = getApp();

Page({
    data: {
        active: 0,
        avatar_image: "",
        text: "",
        nickname: "",
        list: [],
        language: "",
        isLoadMore: !0,
        page: 1,
        total_page: 0,
        un_settlement_count: 0,
        finish_settlement_count: 0,
        one_consignment_sum: 0,
        consignment_sum: 0
    },
    onLoad: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        }), this.getData(), this.get_total();
    },
    get_total: function() {
        var a = this;
        t._postNetWork({
            url: t.getNetAddresss("plugin.consignment.frontend.controllers.withdrawal.index"),
            success: function(e) {
                var n = e.data, s = n.result, i = n.msg;
                if (s) {
                    var o = e.data.data, g = o.member, c = o.plugin_name, u = o.statistics;
                    a.setData({
                        un_settlement_count: u.un_settlement_count,
                        finish_settlement_count: u.finish_settlement_count,
                        one_consignment_sum: u.one_consignment_sum,
                        consignment_sum: u.consignment_sum,
                        username: g.username,
                        avatar_image: g.avatar_image
                    }), wx.setNavigationBarTitle({
                        title: c
                    });
                } else t.tips(i);
            }
        });
    },
    change: function(t) {
        this.setData({
            active: t.detail.index
        }), this.getData(1);
    },
    getData: function() {
        var a = this, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, n = {
            page: e,
            status: this.data.active - 1
        };
        0 == this.data.active && delete n.status, t._postNetWork({
            url: t.getNetAddresss("plugin.consignment.frontend.controllers.withdrawal.get-exchange-voucher-list"),
            data: n,
            success: function(n) {
                var s = n.data, i = s.result, o = s.msg;
                if (i) {
                    var g = n.data.data.settlement_record_list, c = [];
                    c = 1 == e ? g.data || [] : a.list.concat([ g.data ]), a.data.page = g.current_page, 
                    a.data.total_page = g.last_page, a.setData({
                        list: c
                    });
                } else t.tips(o);
            }
        });
    },
    getMoreData: function() {
        if (!(this.data.page >= this.data.total_page)) {
            var t = this.data.page + 1;
            this.getData(t);
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});